﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.IO;

public class TestMobAPI : MonoBehaviour
{
	public Text txt;
	public InputField phoneNum;
	public Button btn_requre;
	// Use this for initialization
	void Start()
	{
		btn_requre.GetComponent<Button>().onClick.AddListener(Click);
        DirectoryInfo info;
        info.GetFiles
	}

	void Click()
	{
		txt.text = "";
		AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
		AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
		jo.Call("OnRequest", phoneNum.text.Trim());

	}
	public void OnCoderReturn(string result)
	{
		string[] args = result.Split('|');
		foreach (var item in args)
		{
			txt.text += item;
			txt.text += "\n";
		}
		phoneNum.text = "";
	}
	void Update()
	{
		if (Input.GetKeyDown(KeyCode.Escape))
			Application.Quit();
	}

}
